#ifndef _INCLUDE_ONET_LOGGER_
#define _INCLUDE_ONET_LOGGER_

/*
    Copright: Kai "DrHalan" Mast - www.freakybytes.org

    This file is part of OpenNetwork. See OpenNetwork.h for license information.
*/

#include <stdio.h>
#include <fstream>
#include <iostream>
#include <ostream>
#include <time.h>
#include <string>
#include <map>
#include "OpenNetwork/types.h"

namespace onet
{

enum ELogMessageType
{
    ELMT_Error = 0,
    ELMT_Warning,
    ELMT_User,
    ELMT_Info,
    ELMT_Custom,
};

//! A logger-class
class CLogger
{
    public:
        CLogger();
        ~CLogger();

        bool log(u16 type, std::string);

        bool setLogFile( std::string );

        void setLogToFile( bool value);

        bool isLoggingToFile();

        //! Set the name of a message type
        //! Can overwrite old names!
        void setType(u16 type, std::string);

    private:
        std::ofstream logFile;
        bool logToFile;

        //! An std::map holding the strings of the message types
        std::map<u16, std::string> types;
};

} //! end namespace onet

#endif // _INCLUDE_ONET_LOGGER_
